import unittest
from HtmlTestRunner import HTMLTestRunner

from login_test import TestDemo

# TestLoader方式添加
suite = unittest.defaultTestLoader.discover('', 'login_test.py')
# suite = unittest.TestLoader().discover('', 'login_test.py')

# 原始TestSuite添加
# suite = unittest.TestSuite()
# suite.addTest(unittest.makeSuite(TestDemo))


# 原始TextTestRunner方式运行
runner = unittest.TextTestRunner()
runner.run(suite)

# HTMLTestRunner方式运行（生成测试报告）(运行失败，有问题)
# file = 'report.html'
# with open(file, 'wb') as f:
#     runner = HTMLTestRunner(f)
#     runner.run(suite)
